package com.tledu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tledu.mapper.SectionMapper;
import com.tledu.mapper.SubjectMapper;
import com.tledu.pojo.Section;
import com.tledu.pojo.Subject;
import com.tledu.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: wzw
 * @Date: 2022/5/24
 */
@Service
public class SubjectServiceImpl  extends ServiceImpl<SubjectMapper, Subject>  implements SubjectService {


    @Autowired
    private SubjectMapper subjectMapper;

    /**
     *
     * @param current  当前页
     * @param size    每一页的条数
     * @param subject_title
     * @return
     * @Author wzw
     */

    @Override
    public PageInfo<Subject> selectPage(int current, int size, String subject_title) {
        PageHelper.startPage(current, size);
        List<Subject> dataList = subjectMapper.selectChange(subject_title);
        return new PageInfo<>(dataList);
    }


    @Override
    public Subject selectById(Integer subject_id) {
        return subjectMapper.selectById(subject_id);
    }

    @Override
    public int deleteById(Integer subject_id) {
        return subjectMapper.deleteById(subject_id);
    }

}
